Skip to content

Fix regression in naturalsize for float and str #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2025

Conversation

loicleyendecker
Copy link
Contributor

Currently if gnu is set to False, calling naturalsize(1.0) or naturalsize("1") will return "1.0 Byte instead of "1 Byte", which was the return value until 4.12.

Copy link

codecov bot commented Apr 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.49%. Comparing base (8059ebe) to head (a79fb3a).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #250   +/-   ##
=======================================
  Coverage   99.49%   99.49%           
=======================================
  Files          11       11           
  Lines         798      798           
=======================================
  Hits          794      794           
  Misses          4        4           
Flag Coverage Δ
macos-latest 97.74% <100.00%> (ø)
ubuntu-latest 97.74% <100.00%> (ø)
windows-latest 95.73% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

Like #239, this was also caused by #226 and this is the similar fix for the other case.

@hugovk hugovk added the changelog: Fixed For any bug fixes label Apr 9, 2025
@hugovk hugovk changed the title 1.0 Byte should be displayed as 1 Byte Fix regression in naturalsize for float and int Apr 10, 2025
@hugovk hugovk changed the title Fix regression in naturalsize for float and int Fix regression in naturalsize for float and str Apr 10, 2025
@hugovk hugovk merged commit 2968d44 into python-humanize:main Apr 10, 2025
34 checks passed
@hugovk
Copy link
Member

hugovk commented Apr 10, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: Fixed For any bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants